<?php

/*
 * Copyright 2011 Google Inc.
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

defined( '_JEXEC' ) or die( 'Restricted access' );

class HTML_videositemapgenerator{
	function listSitemaps( $option , $files){
		?>
		<form action="index.php" method="post" name="adminForm">
		<table class="adminlist">
			<thead>
				<tr>
					<th colspan="3" class="title">Video sitemaps registred</th>
				</tr>
			<?php 
		
		
			if( !empty($files) ){
				?>
					<tr>
						<th width="30%" class="title">File</th>
						<th width="15%">Size</th>
						<th width="10%">Modified on</th>
					</tr>
				</thead>
				<?php 
					$k = 0;
					for($i=0, $n=count($files); $i < $n; $i++){
						$file = $files[$i];
						?>
							<tr class="<?php echo "row$k"; ?>">
								<td><a href="<?php echo JURI::root() . $file['name'];?>" target="_blank"><?php echo $file['name']; ?></a></td>
								<td><?php echo $file['size']; ?></td>
								<td><?php echo $file['mtime']; ?></td>
							</tr>				
						<?php 
						$k = 1 - $k;				
					}
				?>	
				
			<?php
		}
		else{
			?>	
				</thead>
				<tr>
					<td colspan="3">No video sitemap files created.</td>	
				</tr>
			<?php
		}
		?>	
				</table>
				<input type="hidden" name="option" value="<?php echo $option;?>" /> 
				<input type="hidden" name="task" value="" /> 
				<input type="hidden" name="boxchecked" value="0" />
				<input type="checkbox" name="force"/> Force rebuild?
			</form>
		<?php
		
		//$files = JFolder::files(JPATH_ROOT, $filter = '.', $recurse=false, $fullpath=true , $exclude=array("inc"));
		//echo "<pre>".print_r($files,1)."</pre>";
	}
	
	function build( $option , $data) {
		?>
		<h3>Sitemaps removed: <?php echo $data['clear']; ?></h3>
		<h2><?php echo $data['final']; ?></h2>
		<?php 
	}
	
	
}